package servlet.announce;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import bean.control.AnnounceMgr;
import bean.entity.Announce;

@SuppressWarnings("serial")
public class EditAnnounceServlet extends HttpServlet {
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		HttpSession session = req.getSession();
		
		if (session.getAttribute("memId") != null && session.getAttribute("memId").equals("0")) {
			List<Announce> annList = AnnounceMgr.queryAllAnnounceOrderByPoTime();
			
			req.setAttribute("annList", annList);
			req.getRequestDispatcher("./announce/editAnnounce.jsp").forward(req, resp);
		}
		else
			resp.sendRedirect("./index");
	}
}
